home *** CD-ROM | disk | FTP | other *** search
- Gunnar.Sylthe@nsd.uib.no wrote:
- >
- >I have been trying to download the Chameleon evaluation copy from Netmanage,
- >but the ftp connection from here to ftp.netmanage.com is just too slow.
-
- It's not just you. I left it going overnight and got only two of the four
- files. If they are using their own products to run their ftp machine, this
- is not a good sign.
-
- --
-
- ------------------------------------------------------
- Jack Hamilton Postal: POB 281107 SF CA 94128 USA
- jfh@netcom.com Packet: kd6ttl@w6pw.#nocal.ca.us.na
- From news@bigblue.oit.unc.edu Fri Feb 25 15:08:03 1994
- Received: from bigblue.oit.unc.edu by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.07) with SMTP
- id AA24113; Fri, 25 Feb 1994 10:27:35 -0500
- Received: by bigblue.oit.unc.edu (AIX 3.2/UCB 5.64/4.03)
- id AA16627; Fri, 25 Feb 1994 10:24:57 -0500
- Received: from GATEWAY by bigblue with netnews
- for winsock@sunsite.unc.edu (winsock@sunsite.unc.edu)
- To: winsock@sunsite.unc.edu
- Date: Fri, 25 Feb 1994 15:08:03 GMT
- From: snewton@oac.hsc.uth.tmc.edu (Steven E. Newton)
- Message-Id: <snewton.285.2D6E1453@oac.hsc.uth.tmc.edu>
- Organization: Academic Computing
- Sender: ses
- References: <2kjgf0$9fm@jaws.cs.hmc.edu>
- Subject: Re: Winsock API Ques--Dotted IP address from socket?
-
- In article <2kjgf0$9fm@jaws.cs.hmc.edu> aoliver@muddcs.claremont.edu (Andy Oliver) writes:
- > I am trying to find out the dotted IP address of the machine to which a
- >socket is connected. My program listens for connection attempts and accepts
- >them, so I don't know the remote machine's address to begin with. I can
- >call 'getpeername' and have it fill a sockaddr structure, but I don't know
- >where to go from there. The sockaddr data structure consists of a family
- >field and a 14 byte address array according to the winsock header file. I
- >have tried calling 'inet_ntoa' with the address array to no avail.
- > Any ideas?
-
-
- Pretty boilerplate... this routine should work:
- /*
- * Code stolen from nntp.....
- *
- * inet_netnames -- return the network, subnet, and host names of
- * our peer process for the Internet domain.
- *
- * Parameters: "sock" is our socket, which we don't need.
- * "sin" is a pointer to the result of
- * a getpeername() call.
- * "host_name"
- * is filled in by this routine with the
- * corresponding ASCII names of our peer.
- * Returns: Nothing.
- * Side effects: None.
- *
- */
-
- inet_netnames(sock, sin, host_name)
- int sock;
- struct sockaddr_in *sin;
- char *host_name;
- {
- u_long net_addr;
- struct hostent *hp;
- struct netent *np;
-
- net_addr = inet_netof(sin->sin_addr); /* net_addr in host order */
- np = getnetbyaddr(net_addr, AF_INET);
-
- hp = gethostbyaddr((char *) &sin->sin_addr.s_addr,
- sizeof (sin->sin_addr.s_addr), AF_INET);
-
- if (hp != NULL)
- (void) strcpy(host_name, hp->h_name);
- else
- (void) strcpy(host_name, inet_ntoa(sin->sin_addr));
- }
-
- Now, use it like this:
-
- int sockfd
- struct sockaddr sa;
- int length;
- char host_name[256];
-
- getpeername(sockfd, &sa, &length);
- inet_netnames(sockfd, &sa, host_name);
-
-
- + + + + | snewton@oac.hsc.uth.tmc.edu
- But if |
- I tried | Nobody else speaks for me,
- I could | and I speak for no one else.
- Destroy |http://oac3.hsc.uth.tmc.edu/staff/snewton/index.html
- Your Heart | + + + + + + + + +
-
-